import torch
# def norm_state(state):
#     #return state / torch.tensor([[3000, 4, 1, 5, 1, 20e5, 2]*user_num]).to(device)
#     return state / torch.tensor([[1,1, 20e5, 2] * user_num]).to(device)

def translateAction(val, user_num, server_num):
    # user_num 是列表长度， server_num是每个元素的范围, val 是整数
    action = []
    while val > 0:
        action.insert(0, val % server_num)
        val = val // server_num
    while len(action)<user_num:
        action.insert(0, 0)
    return action